<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <title>我的订单</title>

    <link th:include="common::com_css">

</head>
<body>
<section>
    <div th:replace="common::#member_leftmenu"></div>
    <div class="main-content">
        <div th:replace="common::#member_headermenu"></div>
        <div class="wrapper">
            <div class="col-sm-12">
                <div class="adv-table editable-table">
                    <section id="no-more-tables">
                        <div th:replace="common :: #com_alert"></div>
                        <table th:if="${orderList}!=null" class="table table-bordered table-striped table-condensed cf" id="editable-sample">
                            <thead class="cf">
                            <tr>
                                <th style="text-align: center">订单号</th>
                                <th style="text-align: center">订单内容</th>
                                <th style="text-align: center">选座情况</th>
                                <th style="text-align: center">订单时间</th>
                                <th style="text-align: center">订单总价</th>
                                <th style="text-align: center">订单状态</th>
                                <th style="text-align: center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <tr th:each="o:${orderList}" style="text-align: center">
                                    <td data-title="订单号">
                                        <span th:text="${o.orderNum}"></span>
                                    </td>
                                    <td data-title="订单内容" style="text-align: center">
                                        <span th:text="${o.orderInfo}"></span>
                                    </td>
                                    <td data-title="选座情况">
                                        <span th:text="${o.sitNum}"></span>
                                    </td>
                                    <td data-title="订单时间">
                                        <span th:text="${o.orderTime}"></span>
                                    </td>
                                    <td data-title="订单总价">
                                        <span th:text="${o.orderPrice}"></span>
                                    </td>
                                    <td data-title="订单状态" th:switch="${o.orderState}">
                                        <span class="label label-warning" th:case="0">未支付</span>
                                        <span class="label label-success" th:case="1">交易成功</span>
                                        <span class="label label-danger" th:case="2">交易取消</span>
                                    </td>
                                    <td data-title="操作" th:switch="${o.orderState}">
                                        <div th:case="0">
                                            <a class="btn btn-success p1" put_url="/PayOrder" th:put_id="${o.id}" >去支付</a>
                                            <a class="btn btn-warning c1" put_url="/cancelOrder" th:put_id="${o.id}">取消订单</a>
                                        </div>
                                        <div th:case="1">
                                            <!--播放路径使用的是我的另一个服务器-->
                                            <a class="btn btn-info" href="http://192.168.99.119:38/ " target="_blank" >去观看</a>
                                        </div>
                                        <div th:case="2">
                                            <a class="btn btn-danger d1" put_url="/deleteOrder" th:put_id="${o.id}" >删除订单</a>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <form id="delEmpRorm" method="post">
                            <input type="hidden" id="d_id" name="id">
                        </form>
                    </section>
                </div>
            </div>
        </div>
        <footer class="sticky-footer">
            2021 &copy; <a href="https://github.com/ZhangHeng0805" target="_blank">星曦向荣</a>
        </footer>
    </div>
</section>

<div th:include="common::#com_js"></div>
<script>
    jQuery(document).ready(function() {
        EditableTable.init();
    });
    $(".d1").click(function () {
        var d=window.confirm("确定删除此订单？");
        if(d) {
            $("#d_id").attr("value", $(this).attr("put_id"));
            $("#delEmpRorm").attr("action", $(this).attr("put_url")).submit();
            return false;
        }
    });
    $(".p1").click(function () {
        var d=window.confirm("确定支付此订单？");
        if(d) {
            $("#d_id").attr("value", $(this).attr("put_id"));
            $("#delEmpRorm").attr("action", $(this).attr("put_url")).submit();
            return false;
        }
    });
    $(".c1").click(function () {
        var d=window.confirm("确定取消此订单？取消订单则交易取消");
        if(d) {
            $("#d_id").attr("value", $(this).attr("put_id"));
            $("#delEmpRorm").attr("action", $(this).attr("put_url")).submit();
            return false;
        }
    });
</script>
</body>
</html>